function fnFirstCatalog() {
    vPage = parseInt(document.getElementById('txtCurPage').value); 
    vCurPage = 1;
    document.getElementById('hidCurPage').value = vCurPage;
    
    vTotalPage = parseInt(document.getElementById('txtTotalPage').value);
    document.getElementById('hidTotalPage').value = vTotalPage;
    
    vRecordPerPage = parseInt(document.getElementById('txtRecordPerPage').value);
    
    vStartNum = 1;
    vEndNum = vRecordPerPage;

    document.getElementById('hidStartNum').value = vStartNum;
    document.getElementById('hidEndNum').value = vEndNum;
//    alert('vStartNum: ' + vStartNum + '\nvEndNum: ' + vEndNum + '\nvCurPage: ' + vCurPage);
    document.formAdmin.method = 'POST';
    document.formAdmin.action = 'adminLogic/getTable.php';
    document.formAdmin.submit();
}
function fnPrevCatalog() {
    vPage = parseInt(document.getElementById('txtCurPage').value); 
    if (vPage > 1) {
        vCurPage = vPage - 1;
        if (vCurPage <= 0) {
            vCurPage = 1
        }
        document.getElementById('hidCurPage').value = vCurPage;
        vTotalPage = parseInt(document.getElementById('txtTotalPage').value);
        document.getElementById('hidTotalPage').value = vTotalPage;
    
        vRecordPerPage = parseInt(document.getElementById('txtRecordPerPage').value);
        
        vEndNum = ((vPage - 1) * vRecordPerPage);
        if (vEndNum < vRecordPerPage) {
            vEndNum = vRecordPerPage;
        }
        vStartNum = ((vPage - 2) * vRecordPerPage);
        if (vStartNum < 0) {
            vStartNum = 1;
        }
        
        document.getElementById('hidStartNum').value = vStartNum;
        document.getElementById('hidEndNum').value = vEndNum;
//        alert('vStartNum: ' + vStartNum + '\nvEndNum: ' + vEndNum + '\nvCurPage: ' + vCurPage);
        document.formAdmin.method = 'POST';
        document.formAdmin.action = 'adminLogic/getTable.php';
        document.formAdmin.submit();
    }
}
function fnNextCatalog() {
    vTotalPage = parseInt(document.getElementById('txtTotalPage').value);
    document.getElementById('hidTotalPage').value = vTotalPage;
    vPage = parseInt(document.getElementById('txtCurPage').value); 
    if (vPage < vTotalPage) {
        vCurPage = vPage + 1;
        if (vCurPage > vTotalPage) {
            vCurPage = vTotalPage
        }
        document.getElementById('hidCurPage').value = vCurPage;
        
        vRecordPerPage = parseInt(document.getElementById('txtRecordPerPage').value);
        vTotalRecord = parseInt(document.getElementById('txtTotalRow').value);
        
        vEndNum = ((vPage + 1) * vRecordPerPage);
        if (vEndNum > vTotalRecord) {
            vEndNum = vTotalRecord;
        }
        vStartNum = ((vPage * vRecordPerPage) + 1);
        if (vStartNum > vTotalRecord) {
            vStartNum = (vTotalRecord - vRecordPerPage) + 1;
        }
        
        document.getElementById('hidStartNum').value = vStartNum;
        document.getElementById('hidEndNum').value = vEndNum;
//        alert('vStartNum: ' + vStartNum + '\nvEndNum: ' + vEndNum + '\nvCurPage: ' + vCurPage);
        document.formAdmin.method = 'POST';
        document.formAdmin.action = 'adminLogic/getTable.php';
        document.formAdmin.submit();
    }
}
function fnLastCatalog() {
    vTotalPage = parseInt(document.getElementById('txtTotalPage').value);
    document.getElementById('hidTotalPage').value = vTotalPage;
    vPage = parseInt(document.getElementById('txtCurPage').value); 
    vCurPage = vTotalPage;
    document.getElementById('hidCurPage').value = vCurPage;
    
    vRecordPerPage = parseInt(document.getElementById('txtRecordPerPage').value);
    vTotalRecord = parseInt(document.getElementById('txtTotalRow').value);
    
    vEndNum = vTotalRecord;
    vStartNum = (vTotalRecord - vRecordPerPage) + 1;
    
    document.getElementById('hidStartNum').value = vStartNum;
    document.getElementById('hidEndNum').value = vEndNum;
//    alert('vStartNum: ' + vStartNum + '\nvEndNum: ' + vEndNum + '\nvCurPage: ' + vCurPage);
    document.formAdmin.method = 'POST';
    document.formAdmin.action = 'adminLogic/getTable.php';
    document.formAdmin.submit();
}